﻿using System;
using System.Windows.Forms;
using RentalOfCars.Client.Presentation;

namespace RentalOfCars.Client.WinformsClient
{
    public partial class AddEmployeeWindow : Form, IAddEmployeeWindowView
    {
        public AddEmployeeWindow()
        {
            InitializeComponent();
        }

        public string EmployeeName
        {
            get { return _tbxName.Text; }
        }

        public string EmployeeLastName
        {
            get { return _tbxLastName.Text; }
        }

        public string Patronymic
        {
            get { return _tbxPatronymic.Text; }
        }

        public string Login
        {
            get { return _tbxLogin.Text; }
        }

        public string Passport
        {
            get { return _tbxPassport.Text; }
        }

        public string Phone
        {
            get { return _tbxPhone.Text; }
        }

        public string Password
        {
            get { return _tbxPassword.Text; }
        }

        public int SelectedClassIndex
        {
            get { return _cbxClass.SelectedIndex; }
        }

        public string[] AvailableClasses
        {
            set
            {
                _cbxClass.Items.Clear();
                foreach (string cl in value)
                {
                    _cbxClass.Items.Add(cl);
                }
            }
        }

        public void CloseWindow()
        {
            Close();
        }

        public void ShowWindow()
        {
            ShowDialog();
        }

        public Action OnOk { private get; set; }

        private void _btnOk_Click(object sender, EventArgs e)
        {
            OnOk();
        }
    }
}